# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=unifuzzer
pkgver=5.3385a3b
pkgrel=4
pkgdesc='A fuzzing tool for closed-source binaries based on Unicorn and LibFuzzer.'
groups=('blackarch' 'blackarch-fuzzer' 'blackarch-binary')
arch=('x86_64' 'aarch64')
url='https://github.com/rk700/uniFuzzer'
license=('GPL3')
depends=('glibc' 'unicorn')
makedepends=('git' 'clang')
source=("$pkgname::git+https://github.com/rk700/uniFuzzer.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  make
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 uf "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"
}

